extends "../calxJS_Hide/calxJS_Hide.gd"
func _init():
	pass
func _extInit():
	._extInit()
	chaName = "朱雀幼灵"                   # 角色的名称
	attCoe.atkRan = 2                 # 攻击距离
	attCoe.maxHp = 6                  # 最大生命（每点代表112.5基础数值，取整数，下同）
	attCoe.atk = 7                   # 攻击力（每点代表8.5）
	attCoe.mgiAtk = 4                 # 魔法攻击（每点代表13.7）
	attCoe.def = 4                    # 物理防御（每点代表15）
	attCoe.mgiDef = 4.5                 # 魔法防御（每点代表16.6）
	atkEff = "atk_dao" 
	xb = "火"
	lv = 3
	addSkillTxt("[灵雀火焰]像敌方发射灵兽之火，造成120%火系物理伤害，自身免疫2秒debuff，如果目标身上有朱雀印记\n则<灼烧>目标5秒，并提升自身10%的攻速，最高60%[CD:10]")
	addSkillTxt("[燃烧之舞]驱动体内的灵兽之火不断燃烧，提升物攻和攻速各10%，最高60%(攻速的提升和灵雀火焰相通)\n同时对距离自己最近的三个目标附加持续5秒的朱雀印记[CD:6]")
	addSkillTxt("[火翼连环]使用火焰之翼攻击对方2次，每次造成100%火系物理伤害，如果目标身上有朱雀印记，则加成提升至300%[CD:13]")
	addCdSkill("lingque",10)
	addCdSkill("ranshaozhiwu",6)
	addCdSkill("huoyi",13)

func _castCdSkill(id):
	._castCdSkill(id)
	if id == "lingque":
		var eff = sys.newEff("numHit", position, false, 1)
		eff.setText("灵雀火焰", "#FF0099")
		eff.anim.set_speed_scale(0.2)
		typeHurtCha(aiCha,att.atk*1.2,Chara.HurtType.PHY,Chara.AtkType.SKILL)
		addBuff(bf.b_gb_myfm.new(2))
		var bf2:Buff = aiCha.hasBuff("zhuque")
		var bf1 = hasBuff("gongsu1")
		if bf2 !=null:
			aiCha.addBuff(bf.zhuoshao.new(5))
		if bf1 == null:
			addBuff(bf.gongsu1.new())
		elif bf1.att.spd < 0.6:
			bf1.att.spd += 0.1
	if id == "ranshaozhiwu":
		var bf2 = hasBuff("wugong1")
		if bf2 == null:
			addBuff(wugong1.new())
		elif bf2.att.atkL < 0.6:
			bf2.att.atkL += 0.1
		else:pass
		var buff = hasBuff("gongsu1")
		if buff == null:
			addBuff(bf.gongsu1.new())
		elif buff.att.spd < 0.6:
			buff.att.spd += 0.1
		yinji()
	if id == "huoyi":
		var bf:Buff = aiCha.hasBuff("zhuque")
		if bf !=null:
			for i in range(2):
				var eff = sys.newEff("numHit", position, false, 1)
				eff.setText("真火翼连环", "#FF0099")
				eff.anim.set_speed_scale(0.2)
				typeHurtCha(aiCha,att.atk*3,Chara.HurtType.PHY,Chara.AtkType.SKILL)
		else:
			for i in range(2):
				var eff = sys.newEff("numHit", position, false, 1)
				eff.setText("火翼连环", "#FF0099")
				eff.anim.set_speed_scale(0.2)
				typeHurtCha(aiCha,att.atk*1,Chara.HurtType.PHY,Chara.AtkType.SKILL)

func yinji():
	var chas = getAllChas(1)
	chas.sort_custom(self,"sort")
	for i in range(3):
		if i >= chas.size() : break
		chas[i].addBuff(bf.zhuque.new(5))

func sort(a,b):
	if cellRan(a.cell,cell) < cellRan(b.cell,cell) :
		return true
	return false



class zhuque:
	extends Buff
	var dispelable = false
	func _init(lv = 1):
		attInit()
		id = "zhuque"
		life = lv

class wugong1:
	extends Buff
	func _init():
		attInit()
		var dispelable = false
		id = "wugong1"	
		att.atkL += 0.1